<template>
  <div style="display: inline-block;">
    <el-button type="primary" @click="dialogTableVisible = true">修改</el-button>
    <el-dialog v-el-drag-dialog :visible.sync="dialogTableVisible" title="修改" @close="close">
      <el-form ref="row_data" label-position="left" label-width="70px" style="width: 400px; margin-left:50px;">
        <el-form-item :label="'id'" prop="id">
          <el-input v-model="row_data.id" placeholder="id"/>
        </el-form-item>
        <el-form-item :label="'提现说明'" prop="withdrawlInstructions">
          <el-input v-model="row_data.withdrawlInstructions" placeholder="提现说明"/>
        </el-form-item>
        <el-form-item :label="'开店宣传'" prop="shopPublicity">
          <el-input v-model="row_data.shopPublicity" placeholder="开店宣传"/>
        </el-form-item>
        <el-form-item :label="'开店步骤'" prop="shopSteps">
          <el-input v-model="row_data.shopSteps" placeholder="开店步骤"/>
        </el-form-item>
        <el-form-item :label="'注意事项'" prop="noticeItem">
          <el-input v-model="row_data.noticeItem" placeholder="注意事项"/>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitForm()">编辑</el-button>
          <el-button @click="close()">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import elDragDialog from '@/directive/el-dragDialog' // base on element-ui
import store from '@/store'
import { edit } from '@/api/system/configuration_info'

export default {
  name: 'DragDialogDemo',
  directives: { elDragDialog },
  props: {
    row_data: {
      type: Object,
      // 对象或数组默认  值必须从一个工厂函数获取
      default: function() {
        return null
      }
    }
  },
  data() {
    return {
      dialogTableVisible: false
    }
  },
  created: function() {
    console.log(this.row_data)
  },
  methods: {
    submitForm() {
      edit(store.getters.token, this.row_data).then(res => {
        this.close()
      })
    },
    close() {
      this.$emit('getLists')
      this.dialogTableVisible = false
    }
  }
}
</script>
